<?php
header('Content-Type:text/html; charset=UTF-8');
session_start();
if (empty($_SESSION['user'])) {
    header('location:dl.php');
    exit();
}
@$zid = $_SESSION['zid'];
@$je = $_REQUEST['je'];
$pdo = new PDO('mysql:dbname=dcxt;charset=utf8', 'root');
$s = $pdo->prepare('select now()');
$s->execute();
$datesj = $s->fetch(PDO::FETCH_NAMED);
$scsj=$datesj['now()'];
if ($je != null){
$s9 = $pdo->prepare('insert into dingdan(czzid,scsj,je,zt) values(:czzid,:scsj,:je,:zt)');
$s9->execute(array(
    'czzid' => $zid,
    'scsj' =>$scsj,
    'je'=>$je,
    'zt'=>'待付款'
));
}
?>
<html>
<head>
<title>Bootstrap 模板</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
	charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="web/css/bootstrap.min.css" rel="stylesheet">
<script src="web/js/jquery-1.11.1.min.js"></script>
<script src="web/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
		<script src="js/html5shiv.js"></script>
		<script src="js/respond.min.js"></script>
		<![endif]-->
</head>
<body>
	<?php include 'dh.php'; ?>
	<div class="container">
		<div class="col-xs-2">
			<a href="ddjl.php" class="btn btn-default btn-block">订单历史记录</a>
			<a href="dcxt.php" class="btn btn-default btn-block">返回首页</a>
		</div>
		<div class="col-xs-10">
			<div class="panel panel-primary">
				<div class="panel-heading">
					<div class="panel-lilte">
						<span class="glyphicon glyphicon-list">
							<b>订单列表</b>
						</span>
					</div>
				</div>
				<table class="table table-bordered table-hover">
					<tr>
						<th>餐桌</th>
						<th>生成日期</th>
						<th>金额</th>
						<th>操作</th>
					</tr>
					<?php
					$s = $pdo->prepare('select * from dingdan join cz on dingdan.czzid = cz.id where dingdan.scsj=:ss');
                        $s->execute(array('ss'=>$scsj));
                        $data = $s->fetchAll(PDO::FETCH_NAMED);
                        foreach ($data as $value) {
                            ?>			
					<tr>
						<td><?php echo $value['czm']?></td>
						<td><?php echo $value['scsj']?></td>
						<td><?php echo $value['je']?><span style="color: #8B3A3A">[<?php echo $value['zt']?>]</span></td>
						<td>
							<a href="zhifu.php?ddid=<?php echo $value['id'][0] ?>" >结账</a>
							<a href="ddlb.php?ddid=&zbzf" data-toggle="modal">删除</a>
						</td>
					</tr>
					<?php }?>				
				</table>
			</div>
		</div>
	</div>
	<div id="scdd" class="modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close" data-dismiss="modal">&times;</button>
					<h3 class="modal-title">确定删除[]订单</h3>
				</div>
				<div class="modal-body">你确定要删除餐桌[]在[]的订单吗？</div>
				<div class="modal-footer">
					<a href="#" class="btn btn-default">确定</a>
					<button class="btn btn-default" data-dismiss="modal">取消</button>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
